package org.example.sys.cfg;

import org.example.sys.bean.ResponseData;
import org.example.sys.bean.ResponseMsg;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ErrorControllerAdvice {

    @ExceptionHandler(Exception.class)
    public ResponseData handlerError(Exception e) {
        return new ResponseData(ResponseMsg.FAILED.getCode(), e.getMessage());
    }
}